import open3d as o3d
import numpy as np

#read stl file
def read_stl(filename):
    p=o3d.io.read_triangle_mesh(filename)
    return p

#show mesh object in window
def visualise(p):
    o3d.visualization.draw_geometries([p])

def get_type(p):
    print(type(p))

def get_vertices(mesh, remove_repite=True):
    if  remove_repite:
        np.unique(np.array(mesh.vertices), axis=0)
    return np.array(mesh.vertices)


#this is for python test
if __name__ =="__main__":
    filename="test_file1.STL"
    mesh=read_stl(filename)
    visualise(mesh)
    p=get_vertices(mesh,remove_repite=True)